package com.ruoyi.hotel.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.hotel.domain.LyhmsRoom;
import com.ruoyi.hotel.mapper.LyhmsRoomMapper;
import com.ruoyi.hotel.service.ILyhmsRoomService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Service业务层处理
 * 
 * @author ruoyi
 * @date 2022-02-28
 */
@Service
public class LyhmsRoomServiceImpl implements ILyhmsRoomService
{
    @Autowired
    private LyhmsRoomMapper lyhmsRoomMapper;

    /**
     * 查询
     * 
     * @param id 主键
     * @return
     */
    @Override
    public LyhmsRoom selectLyhmsRoomById(Long id)
    {
        return lyhmsRoomMapper.selectLyhmsRoomById(id);
    }

    /**
     * 查询列表
     * 
     * @param lyhmsRoom
     * @return
     */
    @Override
    public List<LyhmsRoom> selectLyhmsRoomList(LyhmsRoom lyhmsRoom)
    {
        return lyhmsRoomMapper.selectLyhmsRoomList(lyhmsRoom);
    }

    /**
     * 新增
     * 
     * @param lyhmsRoom
     * @return 结果
     */
    @Override
    public int insertLyhmsRoom(LyhmsRoom lyhmsRoom)
    {
        long deptId = SecurityUtils.getCurrentDeptId();
        lyhmsRoom.setDeptId(deptId);
        lyhmsRoom.setCreateTime(DateUtils.getNowDate());
        return lyhmsRoomMapper.insertLyhmsRoom(lyhmsRoom);
    }

    /**
     * 修改
     * 
     * @param lyhmsRoom
     * @return 结果
     */
    @Override
    public int updateLyhmsRoom(LyhmsRoom lyhmsRoom)
    {
        return lyhmsRoomMapper.updateLyhmsRoom(lyhmsRoom);
    }

    /**
     * 批量删除
     * 
     * @param ids 需要删除的主键
     * @return 结果
     */
    @Override
    public int deleteLyhmsRoomByIds(Long[] ids)
    {
        return lyhmsRoomMapper.deleteLyhmsRoomByIds(ids);
    }

    /**
     * 删除信息
     * 
     * @param id 主键
     * @return 结果
     */
    @Override
    public int deleteLyhmsRoomById(Long id)
    {
        return lyhmsRoomMapper.deleteLyhmsRoomById(id);
    }

    @Override
    public List<LyhmsRoom> ListName(String type) {
        return lyhmsRoomMapper.ListName(type);
    }

    @Override
    public LyhmsRoom selectLyhmsRoomByName(String name) {
        return lyhmsRoomMapper.selectLyhmsRoomByName(name);
    }
}
